All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class quicktime.app.display.DirectGroup

java.lang.Object
   |
   +----quicktime.app.spaces.SimpleSpace
           |
           +----quicktime.app.display.GroupDrawable
                   |
                   +----quicktime.app.display.DirectGroup

public class DirectGroup
extends GroupDrawable
A DirectGroup contains a set of QTDrawable objects that present their visual contents directly to the screen.

Items that overlap screen space will draw over each other and the front object will clip the rear object so that the rear object does not draw in the area occupied by the front object.

When the group is resized the group's items will not be resized or moved but clipped to the new viewing area of the DirectGroup. Doing a setMatrix on a DirectGroup will inherit the default behaviour of the GroupDrawable super class which merely repositions the group - it will not scale, rotate or skew the group or its members. As such the DirectGroup's display area reperesents a viewing area for its members and when this viewing area is changed the user will see more or less of the members that are in the DirectGroup.

This behaves different from the SWCompositor group - where a resize of that group will resize and scale the members of that group.

This behaviour of the DirectGroup allows an application to use the DirectGroup as a clipping area for its members, where the members of the group are not resized. This class can be used to implement a scrolling pane for example. For example an application may have a very large image that it wants to presents only portions of it. If the application used the GraphicsImporterDrawer (GID) as the client of the QTCanvas the image presented by the GID would be scaled to the viewing area of the QTCanvas. However if the client of the canvas was a DirectGroup and the group contained the GID then the DirectGroup would represent the viewing area of the GID. The application could define a MouseController and responder for this DirectGroup that allowed the user to click on the GID member and when dragging the mouse around change the part of the image that the user sees. Thus the GID image is not resized, and the DirectGroup acts as a clipping viewing area to only see a part of the GID member.

A DirectGroup can only be a top-level container object. Currently you cannot embed DirectGroups within other (parent) DirectGroups. The isAppropriate() method returns false for a potential DirectGroup member object. In this case the member won't be added, and the addMember methods will return false. If an application wanted to support this capability they should overide the isAppropriate method to allow these kinds of members.


Constructor Index

 o DirectGroup(Dimension, QDColor)
Create a new grouped drawable where the members draw directly to the screen.
 o DirectGroup(Dimension, QDColor, int, int, Protocol)
Create a new grouped drawable where the members draw directly to the screen.

Method Index

 o addedTo(Object)
This method is called by some kind of container object when the Listener is added to the object that is the source of the interest.
 o addMember(Object)
Add a QTDrawable object to the group with a layer setting of 1 and the current location of the the QTDrawable.
 o addMember(Object, int)
Add a QTDrawable object to the group based on the current location of the member and the specified layer parametre.
 o addMember(Object, int, float, float)
Add a QTDrawable object to the group based on the provided alignment and layer parametres.
 o isAppropriate(Object)
Returns true if the Object object is an appropriate member of the Space.
 o memberChanged(QTDrawable)
This tells the group that the position or display size of the drawer has changed and it should recalculate its alignment and clipping based on the new position.
 o redrawMember(QTDrawable, Region)
This is an optimized drawing method that will only reset the clipping of those objects that are behind the supplied member.
 o removedFrom(Object)
This method is called by the specified object when the Listener object is removed from the object that is the source of the interest.
 o setClip(Region)
This method allows you to set a Transformable's clipping region.
 o setDisplayBounds(QDRect)
This method is called automatically via the QTCanvas object associated with this client to set its boundary.
 o setGWorld(QDGraphics)
QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing.
 o setMemberAlignment(QTDrawable, float, float)
This will reset an item's alignment and redraw the group.
 o setMemberLayer(QTDrawable, int)
This sets the layer of the incoming drawable to the new layer.

Constructors

 o DirectGroup
 public DirectGroup(Dimension initialSize,
                    QDColor bc) throws QTException
Create a new grouped drawable where the members draw directly to the screen.

Parameters:
initialSize - the size of the display group
bc - the background color of the group
 o DirectGroup
 protected DirectGroup(Dimension initialSize,
                       QDColor bc,
                       int scale,
                       int period,
                       Protocol p) throws QTException
Create a new grouped drawable where the members draw directly to the screen.

Parameters:
initialSize - the size of the display group
bc - the background color of the group
scale - the scale of the space's Timer
period - the period of the space's Timer
p - the default Protocol of members

Methods

 o addedTo
 public void addedTo(Object interest)
This method is called by some kind of container object when the Listener is added to the object that is the source of the interest.

Parameters:
source - the object that is to be the source of interest for the the Listener object.
Overrides:
addedTo in class SimpleSpace
 o removedFrom
 public void removedFrom(Object interest)
This method is called by the specified object when the Listener object is removed from the object that is the source of the interest.

Parameters:
source - the object that is to be the source of interest for the the Listener object.
Overrides:
removedFrom in class SimpleSpace
 o isAppropriate
 public boolean isAppropriate(Object object)
Returns true if the Object object is an appropriate member of the Space. To be an appropriate member the object must pass the passProtocol method of the Protocol object of the Space.

In addition to the requirement that the object be some kind of QTDrawable, the object may also NOT be some kind of GroupDrawable. Thus you cannot embed DirectGroup objects in a parent DirectGroup.

Parameters:
object - the Object to test
Returns:
true if the object passes the current protocol of the Protocol object of the Space.
Overrides:
isAppropriate in class SimpleSpace
 o addMember
 public boolean addMember(Object member,
                          int layer,
                          float xAlign,
                          float yAlign) throws QTException
Add a QTDrawable object to the group based on the provided alignment and layer parametres. This method is provided as a convenience method to position a member in the current display space of the Group.

Parameters:
drawer - the QTDrawable object to be added
layer - the layer where the drawer will be placed
xAlign - the x position of the drawable within the group - 0 is left, 1 is bounds.width - member.width
yAlign - the y position of the drawable within the group - 0 is top, 1 is bounds.height - member.height
Returns:
true if the member is appropriate and was added.
 o addMember
 public boolean addMember(Object member,
                          int layer) throws QTException
Add a QTDrawable object to the group based on the current location of the member and the specified layer parametre.

Parameters:
drawer - the QTDrawable object to be added
layer - the layer where the drawer will be placed
Returns:
true if the member is appropriate and was added.
Overrides:
addMember in class GroupDrawable
 o addMember
 public boolean addMember(Object member) throws QTException
Add a QTDrawable object to the group with a layer setting of 1 and the current location of the the QTDrawable.

Parameters:
member - the member to add
Returns:
true if the member is appropriate and was added.
Overrides:
addMember in class SimpleSpace
 o setGWorld
 public void setGWorld(QDGraphics cgp) throws QTException
QTCanvas calls this method to give the client the QDGraphics object it should use to do its drawing. If the incoming QDGraphics is the QDGraphics.scratch then the drawable will not be visible and can disable itself. If a client is unable to set the graphics world it should throw an exception.

Parameters:
cgp - a QDGraphics object
Overrides:
setGWorld in class GroupDrawable
 o setDisplayBounds
 public void setDisplayBounds(QDRect bounds) throws QTException
This method is called automatically via the QTCanvas object associated with this client to set its boundary.

Parameters:
bounds - a QDRect object describing the boundary
Overrides:
setDisplayBounds in class GroupDrawable
 o redrawMember
 public synchronized void redrawMember(QTDrawable d,
                                       Region invalidRgn) throws QTException
This is an optimized drawing method that will only reset the clipping of those objects that are behind the supplied member. It will call memberChanged to do this. It will then only redraw those members who are behind the specified member if and only if the members behind were effected by the changed location of the specified member. The supplied invalidRgn should specify the area that the supplied QTDrawble was located at as this enables this method to determine which members are effected by the changed location of the member.

Parameters:
d - the drawable from which to recalculate.
invalidRgn - the invalidRgn that the DirectGroup should redraw
Overrides:
redrawMember in class GroupDrawable
 o setClip
 public void setClip(Region theClip) throws QTException
This method allows you to set a Transformable's clipping region.

Parameters:
theClip - a Region that defines the new clipping region.
Overrides:
setClip in class GroupDrawable
 o memberChanged
 public GroupMember memberChanged(QTDrawable d) throws QTException
This tells the group that the position or display size of the drawer has changed and it should recalculate its alignment and clipping based on the new position. If the drawer is not a member of the group then null is returned, if it is a member then a GroupMember object is returned that contains the layout characteristics of the drawer.

Parameters:
d - the drawer that has changed
Returns:
the GroupMember object that is associated with that drawer.
Overrides:
memberChanged in class GroupDrawable
 o setMemberAlignment
 public boolean setMemberAlignment(QTDrawable d,
                                   float xAlign,
                                   float yAlign) throws QTException
This will reset an item's alignment and redraw the group.

Parameters:
d - the drawer to reposition the alignment
xAlign - the new x alignment value for the member
yAlign - the new y alignemen value for the member
Returns:
true if the drawer is a member of the group
Overrides:
setMemberAlignment in class GroupDrawable
 o setMemberLayer
 public boolean setMemberLayer(QTDrawable member,
                               int layer) throws QTException
This sets the layer of the incoming drawable to the new layer. It returns true if the drawable is a member of the group and was reset, false otherwise.

Parameters:
d - the group member to reset
layer - the new layer
Returns:
true if d is a member of the group
Overrides:
setMemberLayer in class GroupDrawable

All Packages  Class Hierarchy  This Package  Previous  Next  Index